/**
 * MarketPriceDto
 */
class MarketPriceDto {
  /**
   * constructor
   * @param {Array} items
   */
  constructor(items) {
    this.TimeLine = new Array();

    let sum = 0.0;
    let avg = 0.0;
    items.forEach((item, index) => {
      sum += item.Price;
      avg = sum / (index + 1);
      this.TimeLine.push({
        time: item.TimePoint,
        price: item.Price,
        volume: item.Volume,
        avg: avg,
      });
    });
  }
}

module.exports = MarketPriceDto;
